<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
		<%--审批/单位新增 --%>
		<base href="<%=basePath%>" />
		<title>${title}</title>
		<link rel="stylesheet" type="text/css" href="<c:url value='/resource/css/common.css'/>"/>
		<script type="text/javascript" src="<c:url value='/resource/js/jquery-1.7.2.min.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/resource/js/jquery.form.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/resource/artdialog/artdialog.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/resource/artdialog/iframetools.js'/>"></script>	      			
		<script type="text/javascript" src="<c:url value='/resource/js/common.js'/>"></script>	
		<script type="text/javascript">
		//决断是否为空
		function isEmpty(id,msg){
			if("" == $(id).val().replace(/(^\s*)|(\s*$)/g, "")){
				art.dialog.tips(msg);
				$(id).focus();
				$(id).select();
				return false;
			}
			return true;
		}
		$(function(){
			$("#annex").change(function(){
				var textValue=$("#annex").val();
				var fileName= textValue.split("\\");
				var trueName=fileName[fileName.length-1];
				$("#wbmc").val(trueName);
			});
		});
		
		//检查表单
		    function checkForm(){
			  return isEmpty("#wblb","请输入文本类别！")&&
			  isEmpty("#wbmc","请输入文本名称！")&&
			  isEmpty("#annex","请添加附件！")
		    }
			function submitForm(pageIndex){
				if(checkForm()){
				$("#upload_form").ajaxSubmit({
					type:"post",
					dataType:"json",
					success:function(data){
						art.dialog.tips("上传成功", 1.5);
						window.setTimeout(function(){
							window.parent.frames["ifrm_data"]._goto(pageIndex);
							art.dialog.close();
						},1500);
						top.unmask();
					},
					error:function(){
						art.dialog.tips("错误");
						top.unmask();
					}
				});}
			}
		</script>
</head>
<body style="margin:0 auto;">
	<div id="form_upload" style="margin-left:10px;">
		<form id="upload_form" action="<c:url value='/text/create.json'/>" method="post">
			<table id="region_form"  cellpadding="0" cellspacing="0" > 
				<tr>
					<td class="c1">文本类别</td>
					<td>
						<select name="type" id="wblb" class="c2">
						  <option value="">请选择</option>
				          <option value="1">队建处讨论文本</option>
				          <option value="2">政治部讨论文本</option>
				          <option value="3">党委会讨论文本</option>
				          <!-- 
				          <option value="4">公告</option>
				          <option value="5">表彰决定</option>
				          <option value="6">表彰命令</option>
				          <option value="7">纪委回函</option>
				           -->
						</select>
					</td>
				</tr>
				<tr>
					<td class="c1">文本编号</td>
					<td><input type="text" name="textNo" id="wbbh" value=""/></td>
				</tr>
				<tr>
					<td class="c1">附件</td>
					<td ><input type="file" id="annex" name="annex" /></td>
				</tr>
				<tr>
					<td class="c1">文本名称</td>
					<td><input type="text" name="name" id="wbmc" value=""></td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>